﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Site.Master" CodeBehind="AssignNewStudentSession.aspx.cs"
         Inherits="SARS.Tutor.AssignNewStudentSession" %>

<%@ Register Src="../UserControl/UcProgramCourse.ascx" TagName="UcProgramCourse"
             TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <style type="text/css">
        .style2 { width: 201px; }

        .style3 { width: 220px; }
    </style>
    <script type="text/javascript" language="javascript">
        function CheckAllStudents(Checkbox) {
            var grvStudents = document.getElementById("<%= grvStudents.ClientID %>");
            for (i = 1; i < grvStudents.rows.length; i++) {
                grvStudents.rows[i].cells[0].getElementsByTagName("INPUT")[0].checked = Checkbox.checked;
            }
        }

        function CheckAllSessions(Checkbox) {
            var grvSessions = document.getElementById("<%= grvSessions.ClientID %>");
            for (i = 1; i < grvSessions.rows.length; i++) {
                grvSessions.rows[i].cells[0].getElementsByTagName("INPUT")[0].checked = Checkbox.checked;
            }
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h1>
        Assign new student to Sessions</h1>
    <br />
    <uc1:UcProgramCourse ID="UcProgramCourse" runat="server" OnSelectedCourseChanged="ucProgramCourse_OnSelectedCourseChanged" />
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <asp:Panel ID="Panel1" runat="server" Direction="LeftToRight">
                <table>
                    <tr>
                        <td class="style3">
                            &nbsp;
                        </td>
                        <td>
                            <asp:Button ID="btnCancel" runat="server" CausesValidation="False" OnClick="btnCancel_Click"
                                        Text=" Cancel  " />
                        </td>
                    </tr>
                    <tr>
                        <td class="style3">
                            &nbsp;
                        </td>
                        <td>
                            <asp:GridView ID="grvStudents" runat="server" AutoGenerateColumns="False" CellPadding="4"
                                          ForeColor="#333333" GridLines="None" EmptyDataText="There is no new assigned student in this course.">
                                <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                                <Columns>
                                    <asp:TemplateField>
                                        <HeaderTemplate>
                                            <asp:CheckBox ID="cbxSelectAll" runat="server" onclick="CheckAllStudents(this);" />
                                        </HeaderTemplate>
                                        <ItemTemplate>
                                            <asp:CheckBox ID="ckbStudent" runat="server" />
                                            <asp:HiddenField ID="hdnStudentID" runat="server" Value="<% #Bind('UserID') %>" />
                                        </ItemTemplate>
                                        <FooterStyle HorizontalAlign="Center" />
                                        <ItemStyle HorizontalAlign="Center" />
                                    </asp:TemplateField>
                                    <asp:BoundField DataField="FirstName" HeaderText="First Name" ReadOnly="True" SortExpression="FirstName" />
                                    <asp:BoundField DataField="LastName" HeaderText="Last Name" ReadOnly="True" SortExpression="LastName" />
                                    <asp:BoundField DataField="DOB" DataFormatString="{0:dd-MMM-yyyy}" HeaderText="Date Of Birth"
                                                    ReadOnly="True" SortExpression="DOB" />
                                    <asp:BoundField DataField="Phone" HeaderText="Phone" ReadOnly="True" SortExpression="Phone" />
                                    <asp:BoundField DataField="Email" HeaderText="Email" ReadOnly="True" SortExpression="Email" />
                                </Columns>
                                <EditRowStyle BackColor="#999999" />
                                <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                                <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                                <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                                <SortedAscendingCellStyle BackColor="#E9E7E2" />
                                <SortedAscendingHeaderStyle BackColor="#506C8C" />
                                <SortedDescendingCellStyle BackColor="#FFFDF8" />
                                <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
                            </asp:GridView>
                        </td>
                    </tr>
                    <tr>
                        <td class="style3">
                            &nbsp;
                        </td>
                        <td>
                        </td>
                    </tr>
                    <tr>
                        <td class="style3">
                            &nbsp;
                        </td>
                        <td>
                            <asp:GridView ID="grvSessions" runat="server" CellPadding="4" ForeColor="#333333"
                                          GridLines="None" AutoGenerateColumns="False" Style="margin-left: 0px" EmptyDataText="There is no session in selected course.">
                                <Columns>
                                    <asp:TemplateField>
                                        <HeaderTemplate>
                                            <asp:CheckBox runat="server" ID="cbxSelectAll" onclick="CheckAllSessions(this);" />
                                        </HeaderTemplate>
                                        <ItemTemplate>
                                            <asp:CheckBox runat="server" ID="ckbSession" />
                                            <asp:HiddenField runat="server" ID="hdnSessionID" Value="<% #Bind('SessionID') %>" />
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:BoundField DataField="SessionTopic" HeaderText="Session Topic" ReadOnly="True" />
                                    <asp:BoundField DataField="SessionType" HeaderText="Session Type" ReadOnly="True" />
                                    <asp:BoundField DataField="StartDate" DataFormatString="{0:dd-MMM-yyyy hh:mm}" HeaderText="Start Date"
                                                    ReadOnly="True" />
                                    <asp:BoundField DataField="EndDate" DataFormatString="{0:dd-MMM-yyyy hh:mm}" HeaderText="End Date"
                                                    ReadOnly="True" />
                                    <asp:BoundField DataField="Status" HeaderText="Status" ReadOnly="True" />
                                    <asp:BoundField DataField="Manager.FullName" HeaderText="Tutor/Lecture" ReadOnly="True" />
                                    <asp:BoundField DataField="Room.RoomName" HeaderText="Room" ReadOnly="True" />
                                    <asp:BoundField DataField="Course.CourseName" HeaderText="Course" ReadOnly="True" />
                                </Columns>
                                <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                                <EditRowStyle BackColor="#999999" />
                                <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                                <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                                <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                                <SortedAscendingCellStyle BackColor="#E9E7E2" />
                                <SortedAscendingHeaderStyle BackColor="#506C8C" />
                                <SortedDescendingCellStyle BackColor="#FFFDF8" />
                                <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
                            </asp:GridView>
                        </td>
                    </tr>
                    <tr>
                        <td class="style3">
                            &nbsp;
                        </td>
                        <td align="right">
                            <asp:Button ID="btnSave" runat="server" Text="     Save     " OnClick="btnSave_Click"
                                        Visible="False" />
                        </td>
                    </tr>
                </table>
            </asp:Panel>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>